/*******************************************************************
 * Copyright (c) 2013 珠海比特讯科技有限公司. All rights reserved.
 * （1）软件的版权将受到法律保护，不允许非经授权的使用；
 * （2）未经版权所有人授权，任何人不得修改、复制和传播软件源代码、图片及其它资源等；
 * （3）未经版权所有人授权，不允许对软件进行修改；
 * （4）未经版权所有人授权，不允许在该软件的基础上开发新的软件；
 * （5）珠海比特讯科技有限公司拥有最终解释权
 *******************************************************************/
package youxiao.bytezon.models;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import youxiao.bytezon.enums.AttendanceState;

@Entity
@Table(name = "course_detail")
public class CourseDetail {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	@Column
	private LocalDate courseDate;

	@Column
	private LocalTime starttime;

	@Column
	private LocalTime endtime;

	@Column
	private String remark;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "course_id")
	private Course course;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "room_id")
	private Room room;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "teacher_id")
	private Teacher teacher;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "school_id")
	protected School school;

	@Column
	private int applylearnCount;

	@Column
	private int trialCount;

	@Column
	private AttendanceState attendanceState;

	@OneToMany(mappedBy = "courseDetail", orphanRemoval = true)
	private Set<StudentCourseDetail> studentCourseDetails = new HashSet<StudentCourseDetail>(0);

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public LocalDate getCourseDate() {
		return courseDate;
	}

	public void setCourseDate(LocalDate courseDate) {
		this.courseDate = courseDate;
	}

	public LocalTime getStarttime() {
		return starttime;
	}

	public void setStarttime(LocalTime starttime) {
		this.starttime = starttime;
	}

	public LocalTime getEndtime() {
		return endtime;
	}

	public void setEndtime(LocalTime endtime) {
		this.endtime = endtime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	public int getApplylearnCount() {
		return applylearnCount;
	}

	public void setApplylearnCount(int applylearnCount) {
		this.applylearnCount = applylearnCount;
	}

	public int getTrialCount() {
		return trialCount;
	}

	public void setTrialCount(int trialCount) {
		this.trialCount = trialCount;
	}

	public AttendanceState getAttendanceState() {
		return attendanceState;
	}

	public void setAttendanceState(AttendanceState attendanceState) {
		this.attendanceState = attendanceState;
	}

	public Set<StudentCourseDetail> getStudentCourseDetails() {
		return studentCourseDetails;
	}

	public void setStudentCourseDetails(Set<StudentCourseDetail> studentCourseDetails) {
		this.studentCourseDetails = studentCourseDetails;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}

}
